<!--邮件分发明细-->
<template>
  <div class="app-container">
    <ht-search-form
      v-show="showSearch"
      :dictMap="dictMap"
      :labelWidth="100"
      :queryParams="queryParams"
      :outputQueryParams="queryParams"
      :formOptions="formOptions"
      :advOptions="[]"
      :defaultEventKey="defaultEventKey"
    ></ht-search-form>
    <ht-table
      ref="dataTable"
      rowKey="msgId"
      :showSerialNumber="false"
      :multi-select="false"
      :dictMap="dictMap"
      :reqConfig="reqConfig"
      :queryParams="queryParams"
      :tableBindColumns="tableBindColumns"
      :opButtonList="opButtonList"
    >
      <template v-slot:operate>
        <el-table-column label="操作" align="left" width="100px" fixed="right" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <ht-button-group
              :buttonList="[
                {
                  label: '明细',
                  doFunc: () => {
                    detail(scope.row);
                  },
                },
              ]"
            />
          </template>
        </el-table-column>
      </template>
    </ht-table>

    <mail-send-dtl-dialog ref="mailSendDtlDialog" @editComplete="editComplete"></mail-send-dtl-dialog>
  </div>
</template>
<script>
import { mailSendDtlUrlConfig } from "@/api/cnaps/bizMng/mailSendDtl.js";
import { listPageMixin } from "@/libs/listPageMixin";
import MailSendDtlDialog from "./dialog";

export default {
  name: "mailSendDtl_index",
  mixins: [listPageMixin],
  components: {
    MailSendDtlDialog,
  },
  props: {},
  data() {
    return {
      reqConfig: mailSendDtlUrlConfig,
      defaultEventKey: "",
      //数据字典
      searchFormDictList: ["MSG_SEND_STATUS"],
      // 遮罩层
      loading: true,
      // 弹出层标题
      title: "",
      showSearch: true,
      // 日期范围
      dateRange: [],
      // 查询参数
      queryParams: {
        eventType:"",
        eventDesc:"",
        sendStatus:"",
      },
      formOptions: [],
      opButtonList: () => {
        return [];
      },
      tableBindColumns: [
        {
          label: `事件类型`,
          prop: "eventType",
          width: "200px",
          align: "center",
          formatter: (row) => {
            if (!row.eventType) {
              return "-";
            }
            return row.eventNm;
          },
        },
        { label: `事件描述`, prop: "eventDesc", width: "260px", align: "center" },
        { label: `发送人`, prop: "sendUser", align: "center" },
        { label: `邮件接收人`, prop: "mailRecUser", width: "360px", align: "center" },
        { label: `邮件抄送人`, prop: "mailCopyUser", width: "360px", align: "center" },
        { label: `邮件生成时间`, prop: "msgCrtTime", width: "160px", align: "center", type: "date" },
        { label: `邮件发送时间`, prop: "msgSendTime", width: "160px", align: "center", type: "date" },
        { label: `发送状态`, prop: "sendStatus", align: "center", dictCode: "MSG_SEND_STATUS" },
      ],
    };
  },
  mounted() {
    this.formOptions = [
      {
        type: "input",
        prop: "eventType",
        defaultAttr: {
          label: "事件类型",
          placeholder: "请输入事件类型",
        },
      },
      {
        type: "input",
        prop: "eventDesc",
        defaultAttr: {
          label: "事件描述",
          placeholder: "请输入事件描述",
        },
      },
      {
        type: "dict",
        dict: "MSG_SEND_STATUS",
        prop: "sendStatus",
        defaultAttr: {
          label: "发送状态",
          placeholder: "请选择发送状态",
        },
      },
    ];
  },
  methods: {
    /** todo 查询当天操作员的交易记录 */
    getList() {
      this.doQuery();
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    detail(row) {
      console.log("this.$refs.mailSendDtlDialog", this.$refs.mailSendDtlDialog);
      this.$refs.mailSendDtlDialog.show(row);
    },
    editComplete(state) {
      console.log("editComplete", state);
      if (state == true) {
        this.getList();
      }
    },
  },
};
</script>
<style>
.label-header-msg {
  font-weight: bold;
}
</style>
